package com.attendance.www.hr.service.impl;

import java.util.ArrayList;
import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.attendance.www.hr.beans.PrivilegeGroupBean;
import com.attendance.www.hr.dao.mapper.PrivilegeGroupMapper;
import com.attendance.www.hr.entitys.PrivilegeGroup;
import com.attendance.www.hr.entitys.PrivilegeGroupExample;
import com.attendance.www.hr.service.IPrivilegeGroupService;

@Service
public class PrivilegeGroupServiceImpl implements IPrivilegeGroupService {

	@Resource
	private PrivilegeGroupMapper privilegeGroupDao;
	
	/**
	 * 查询
	 */
	@Override
	public List<PrivilegeGroupBean> getPrivilegeGroupList() {
		PrivilegeGroupExample example=new PrivilegeGroupExample();
		example.createCriteria()
		.andPrivilegeGroupCodeNotEqualTo("1");
		List<PrivilegeGroup> list=privilegeGroupDao.selectByExample(example);
		List<PrivilegeGroupBean> privilegeGroupBeanList=new ArrayList<>();
		for (PrivilegeGroup privilegeGroup : list) {
			PrivilegeGroupBean privilegeGroupBean=new PrivilegeGroupBean();
			privilegeGroupBean.setPrivilegeGroupCode(privilegeGroup.getPrivilegeGroupCode());
			privilegeGroupBean.setPrivilegeGroupId(privilegeGroup.getPrivilegeGroupId());
			privilegeGroupBean.setPrivilegeGroupName(privilegeGroup.getPrivilegeGroupName());
			privilegeGroupBeanList.add(privilegeGroupBean);
		}
		return privilegeGroupBeanList;
	}
}
